package com.hqyj.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hqyj.shop.pojo.Brand;
import com.hqyj.shop.mapper.BrandMapper;
import com.hqyj.shop.service.BrandService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hqyj.shop.util.ResultVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author rock
 * @since 2024-10-12 09:08:10
 */
@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements BrandService {
    @Resource
    BrandMapper mapper;

    @Override
    public ResultVo queryByType(Integer proType) {
        QueryWrapper<Brand> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("pro_type",proType);
        List<Brand> list = mapper.selectList(queryWrapper);
        if(list.size()>0){
            return ResultVo.success(list);
        }
        return ResultVo.error();
    }
}
